<?
require_once("../inc/employee.php");
  /*
  * 
						<? if($results) :?>
						<dl>
							<? foreach ($variable as $key => $value): ?>
							
								<dt><?=$key?></dt>
								<dd><?=$value?></dd>
							<? endforeach; ?>
							
						</dl>
						<? endif; ?>	 	
  * 
  
 //$results = array();
//<img src="../images/stiglogo.png" alt="" class="img-polaroid">
*/
 $results = getEmployees();
 
?>
<!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title><?=$title ?> Employees List</title>
         <? require('../inc/header-info.php'); ?>
    </head>
    <body>
        <div class="container">
            <? include('../inc/nav.php'); ?>
            <div id='button-test'>
            	<a data-toggle="modal" href="#add" class="btn btn-mini btn-primary">Add Employee</a>         	
            </div>
			
            <form> 
			<table class="table table-striped">
    			<caption><h4>NP Commerce Employees Accounts</h4></caption>
    			
    			<thead>
    				<tr>
    					<th>User ID</th>
    					<th>Last Name</th>
    					<th>First Name</th>
    					<th>Security Level</th>
    					<th>Options</th>
    				</tr>
    			</thead>
    			<tbody>
    				<? while($employee = $results->fetch_assoc()): ?>
    					<tr>
							<td><?=$employee['user_id']?></td>
							<td><?=$employee['last_name']?></td>
							<td><?=$employee['first_name']?></td>
                            <td><?=$employee['access_level']?></td>
                            <td>
                            	<a class="edit-link btn btn-mini btn-primary"  href="<?=$url?>employees/edit.php?id=<?=$employee['id']?>">Edit</a>
                            	<a class="delete-link btn btn-mini btn-primary" href="<?=$url?>employees/index.php?id=<?=$employee['id']?>">Delete</a>
                            </td>
                        </tr>
                    <? endwhile; ?>

    			</tbody>
    		</table>
    		</form>
		</div>
		
		 <div id="add" class="modal hide fade in edit-modal" style="display: none; ">
		 	<div class="modal-header">
		 		<a class="close" data-dismiss="modal">X</a>
				<h3>This is a Modal Heading</h3>
            </div>
            <div class="modal-body edit-modal">
            	<h4>Text in a modal</h4>
                <p>All the Help that I need.</p>
            </div>
            <div class="modal-footer">
				<a href="#" class="btn btn-success">Call to action</a>
                <a href="#" class="btn" data-dismiss="modal">Close</a>
            </div>
        </div>
        
        <div class="container">
        	<div id="example" class="modal hide fade in" style="display: none; ">
                <div class="modal-header">
                        <a class="close" data-dismiss="modal">X</a>
                        <h3>This is a Modal Heading</h3>
                </div>
                <div class="modal-body">
                        <h4>Text in a modal</h4>
                        <p>You can add some text here.</p>
                </div>
                <div class="modal-footer">
                        <a href="#" class="btn btn-success">Call to action</a>
                        <a href="#" class="btn" data-dismiss="modal">Close</a>
                </div>
        	</div>
        <p><a href="#example" class="btn btn-primary btn-large">Launch demo modal</a></p>

		</div>
		
		<script type="text/javascript">
			$(function(){
				 $(".edit-link").click(function(){
				 	$.get(this.href, function(data){
                    	$(".edit-modal").html($(data).find("form"));
                    })
                    
                	$("add").modal({ show: true });
                	return false;
             	});

			});
		</script>
	</body>
</html>

